package com.cloudkinto.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cloudkinto.entity.StockRecordDo;
import com.cloudkinto.entity.UserDo;
import com.cloudkinto.extentity.StockAgeDto;
import com.cloudkinto.extentity.StockRecordDto;
import com.cloudkinto.extentity.StockRecordPageDto;
import com.cloudkinto.extentity.StockSnapshotPageDto;
import com.cloudkinto.extentity.stock.DeliveryCountDto;
import com.cloudkinto.extentity.stock.ShopStockRecordDto;
import com.cloudkinto.extentity.stock.StockRecordStatisticDto;
import com.cloudkinto.extentity.stock.StockRecordTotalDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author 张永远
 * @since 2020-06-10
 */
@Mapper
public interface StockRecordDao extends BaseMapper<StockRecordDo> {

    StockRecordStatisticDto getTotalCountFee(@Param("map") Map<String, String> map);

    List<DeliveryCountDto> getDeliveryCount(@Param("map") Map<String, String> map);

    List<StockRecordPageDto> listPage(IPage<StockRecordPageDto> page, @Param("map") Map<String, String> map);

    List<StockRecordPageDto> listPage(@Param("map") Map<String, String> map);


    List<StockRecordPageDto> listPage1(IPage<StockRecordPageDto> page, @Param("map") Map<String, String> map);

    Integer getOrderOutCount(long productId, long shopId, long storageId);

    Integer getOrderOutTurn2FbaCount(long productId, long shopId, long storageId);

    Integer getOrderInCount(long productId, long shopId, long storageId);

    Integer getOrderOutPut(Integer fba, Long productId, Long shopId, Long storageId, Date date);

    List<StockRecordDto> getRecordList(UserDo userDo);

    /****************库存快照模块*******************/

    List<StockSnapshotPageDto> getStockSnapshotList(IPage<StockSnapshotPageDto> page, @Param("map") Map<String, String> map);

    List<StockSnapshotPageDto> getStockSnapshotList(@Param("map") Map<String, String> map);

    List<StockAgeDto> getStockAgeAnalysis(List<Long> storageIdList, List<Long> companyIdList);


    int updateStockById(Long id, int goodQuantity);

    StockRecordTotalDto getTotalCount(Long storageId);


    List<ShopStockRecordDto> getShopStockList(Long productId, Long storageId, int type, String quantityType);
}
